#include<stdio.h>
/*returns rightmost occurence of t in s*/
int strrindex(char s[],char t[]);
int main()
{
 char s[100];
 char t[100];
 printf("enter a string\n");
 gets(s);
 printf("enter the substring to be searched\n");
 gets(t);
 printf("%d",strrindex(s,t));
 return 0;
}

int strrindex(char s[],char t[])
{
 int i,j,k,index=-1;
 for(i=0;s[i]!='\0';i++)
  {
    for(j=i,k=0;t[k]==s[j] && t[k]!='\0';k++,j++);
      if(k>0 && t[k]=='\0')
           index=i;
  }
 
  
  return index;
}
  
  
 

